package gtkwire.widget;

import gtkwire.*;
import java.awt.Color;

/**
*A standard dialog box for selecting a color.
*/
public class GtkColorSelectionDialog extends GtkDialog
{
	private String title = null;

	public GtkColorSelectionDialog( String title)
	{
		super();
		this.widgetType = WT_GtkColorSelectionDialog;
		this.title = title;
		gtkCreate();
	}

	public GtkColorSelectionDialog( String name, GladeKey key )
	{
		super( name, key );
		this.widgetType = WT_GtkColorSelectionDialog;
	}

	protected String[] getCreateData()
	{
		if( title == null ) return null;
		String[] msg = { title };
		return msg;
	}

	/**
	*Returns selected color.
	*/
	public Color getSelectedColor()
	{
		GTKWireMessage answer = app().sendCommandRequest( name, widgetType, GTKWireCommandRequest.GET_SELECTED_COLOR, null );
		int[] c = (int[]) answer.getMessageObject();
		Color color = new Color( c[ 0 ], c[ 1 ], c[ 2 ], c[ 3 ] );//hard code, gladewire_command.c
		return color;
	}



}//end class